<?php
//+---------------------------------------------------------------------------------------------------------------------
//| 人生是荒芜的旅行，冷暖自知，苦乐在心
//+---------------------------------------------------------------------------------------------------------------------
//| Author:Janmas <janmas@126.com>
//+---------------------------------------------------------------------------------------------------------------------
//| 
//+---------------------------------------------------------------------------------------------------------------------


namespace app\admin\controller;


use helper\form\Builder;

class Templet extends Admin
{

	protected $noNeedLogin = ['*'];
	protected $noNeedAuth = ['*'];
	/**
	 * 输入框
	 */
	public function text()
	{
		$html = [
			[//输入框
				'title' => '输入框',
				'key'   => 'text',
				'value' => '这个是输入框',
				'tips'  => '这个是提示 type==text',
				'type'  => 'text'
			],
			[//密码框
				'title' => '密码框',
				'key'   => 'password',
				'value' => '',
				'tips'  => '这个是提示 type==password',
				'type'  => 'password'
			],
			[//数字框
				'title' => '数字框',
				'key'   => 'number',
				'value' => '19970904',
				'tips'  => '这个是提示 type == number',
				'type'  => 'number'
			],
			[//文本域
				'title' => '文本域',
				'key'   => 'textarea',
				'value' => '这个是文本域',
				'tips'  => '这个是提示 type == textarea',
				'type'  => 'textarea'
			],
			[//开关
				'title'  => '开关',
				'key'    => 'switch',
				'value'  => 'on',
				'tips'   => '这个是提示 type == switch/ value==on代表默认选中',
				'type'   => 'switch',
				'option' => ''
			],
			[//隐藏域
				'title' => '这里有个隐藏域',
				'key'   => 'hidden',
				'value' => '',
				'tips'  => '这里有个隐藏域 type==hidden',
				'type'  => 'hidden',
			],
			[//下拉框
				'title'  => '下拉框',
				'key'    => 'select',
				'value'  => '2',
				'tips'   => '这个是select type==select',
				'type'   => 'select',
				'option' => 'xxx:xxx
				aaaa:aaaa
				bbb'
			],
			[//单选框
				'title'  => '单选框',
				'key'    => 'radio',
				'value'  => 'xxx',
				'tips'   => '这个是radio type==radio',
				'type'   => 'radio',
				'option' => 'xxx:xxx
				aaaa:aaaa
				bbb'
			], [//复选框
				'title'  => '复选框',
				'key'    => 'checkbox',
				'value'  => 'xxx',
				'tips'   => '这个是复选框 type==checkbox',
				'type'   => 'checkbox',
				'option' => 'xxx:xxx
				aaaa:aaaa
				bbb'
			], [//单图上传
				'title'  => '单图上传',
				'key'    => 'image',
				'value'  => '',
				'tips'   => '这个是单图上传 type==image',
				'type'   => 'image',
				'option' => ''
			], [//多图上传
				'title'  => '多图上传',
				'key'    => 'images',
				'value'  => '',
				'tips'   => '这个是多图上传 type==images',
				'type'   => 'images',
				'option' => ''
			], [//单图上传
				'title'  => '单文件上传',
				'key'    => 'file',
				'value'  => '',
				'tips'   => '这个是单文件上传 type==file',
				'type'   => 'file',
				'option' => ''
			], [//多图上传
				'title'  => '多文件上传',
				'key'    => 'files',
				'value'  => '',
				'tips'   => '这个是多文件上传 type==files',
				'type'   => 'files',
				'option' => ''
			], [//颜色选择器
				'title'  => '颜色选择器',
				'key'    => 'color',
				'value'  => '',
				'tips'   => '这个是颜色选择器 type==color',
				'type'   => 'color',
				'option' => ''
			],[//编辑器
				'title'  => '编辑器',
				'key'    => 'ueditor',
				'value'  => '<p>asdasdasdasdasdas</p>',
				'tips'   => '这个是百度编辑器 type==ueditor',
				'type'   => 'ueditor',
				'option' => ''
			],[//markDown编辑器
				'title'  => 'md编辑器',
				'key'    => 'content',
				'value'  => '## AAA',
				'tips'   => '这个是markDown编辑器 type==mditor',
				'type'   => 'mditor',
				'option' => ''
			],
		];

		return $this->fetch('templet/index', [ 'html' => (new Builder($html))->getHtml(), 'data' => var_export($html, true) ]);
	}

	public function create(){
	    \app\common\model\FileManager::upload($this->request->file('images'));
	    return $this->success('1','','1',$this->request->file());
    }

}